﻿namespace Hourglass.Qrobot.Models
{
    public sealed class SmartEnums
    {
        /// <summary>
        /// 最近联系类型
        /// </summary>
        public enum RecentType
        {
            /// <summary>
            /// 好友
            /// </summary>
            Friend = 0,

            /// <summary>
            /// 群组
            /// </summary>
            Group = 1,

            /// <summary>
            /// 群聊
            /// </summary>
            Disscuss = 2
        }

        /// <summary>
        /// 性别
        /// </summary>
        public enum Gender
        {
            /// <summary>
            /// 未设置或不可见
            /// </summary>
            Unknow,

            /// <summary>
            /// 男
            /// </summary>
            Male,

            /// <summary>
            /// 女
            /// </summary>
            Female
        }

        /// <summary>
        /// 生肖
        /// </summary>
        public enum Zodiac
        {
            /// <summary>
            /// 未设置
            /// </summary>
            Unknow = 0,

            /// <summary>
            /// 鼠
            /// </summary>
            Rat,

            /// <summary>
            /// 牛
            /// </summary>
            Ox,

            /// <summary>
            /// 虎
            /// </summary>
            Tiger,

            /// <summary>
            /// 兔
            /// </summary>
            Rabbit,

            /// <summary>
            /// 龙
            /// </summary>
            Dragon,

            /// <summary>
            /// 蛇
            /// </summary>
            Snake,

            /// <summary>
            /// 马
            /// </summary>
            Horse,

            /// <summary>
            /// 羊
            /// </summary>
            Goat,

            /// <summary>
            /// 猴
            /// </summary>
            Monkey,

            /// <summary>
            /// 鸡
            /// </summary>
            Rooster,

            /// <summary>
            /// 狗
            /// </summary>
            Dog,

            /// <summary>
            /// 猪
            /// </summary>
            Pig
        }

        /// <summary>
        /// 星座
        /// </summary>
        public enum Constel
        {
            /// <summary>
            /// 未设置
            /// </summary>
            Unknow = 0,

            /// <summary>
            /// 白羊座
            /// </summary>
            Aries,

            /// <summary>
            /// 金牛座
            /// </summary>
            Taurus,

            /// <summary>
            /// 双子座
            /// </summary>
            Gemini,

            /// <summary>
            /// 巨蟹座
            /// </summary>
            Cancer,

            /// <summary>
            /// 狮子座
            /// </summary>
            Leo,

            /// <summary>
            /// 处女座
            /// </summary>
            Virgo,

            /// <summary>
            /// 天秤座
            /// </summary>
            Libra,

            /// <summary>
            /// 天蝎座
            /// </summary>
            Scorpio,

            /// <summary>
            /// 射手座
            /// </summary>
            Sagittarius,

            /// <summary>
            /// 摩羯座
            /// </summary>
            Capricornus,

            /// <summary>
            /// 水瓶座
            /// </summary>
            Aquarius,

            /// <summary>
            /// 双鱼座
            /// </summary>
            Pisces
        }

        /// <summary>
        /// 血型
        /// </summary>
        public enum Blood
        {
            /// <summary>
            /// 未设置
            /// </summary>
            Unknow = 0,
            A,
            B,
            O,
            AB,
            Other
        }

        /// <summary>
        /// 登录类型，未统计
        /// </summary>
        public enum OnlineClientType
        {
            /// <summary>
            /// 手机登录（手机登录时没有clienttype，暂时设置为0）
            /// </summary>
            Mobile = 0,
            Pc = 1
        }

        /// <summary>
        /// 在线状态
        /// </summary>
        public enum OnlineStatus
        {
            /// <summary>
            /// 在线
            /// </summary>
            Online = 10,

            /// <summary>
            /// 离线
            /// </summary>
            Offline = 20,

            /// <summary>
            /// 离开
            /// </summary>
            Away = 30,

            /// <summary>
            /// 繁忙
            /// </summary>
            Busy = 50,

            /// <summary>
            /// Q我吧
            /// </summary>
            Qme = 60,

            /// <summary>
            /// 请勿打扰
            /// </summary>
            Silence = 70
        }

        public static class EnumExtensionUtils
        {
            public static Gender ConvertGender(string gender)
            {
                switch (gender)
                {
                    case "male":
                        return Gender.Male;
                    case "female":
                        return Gender.Female;
                    default:
                        return Gender.Unknow;
                }
            }

            public static OnlineStatus ConvertOnlineStatus(string status)
            {
                status = status.ToLower();
                switch (status)
                {
                    case "online":
                        return OnlineStatus.Online;
                    case "away":
                        return OnlineStatus.Away;
                    case "busy":
                        return OnlineStatus.Busy;
                    case "qme":
                        return OnlineStatus.Qme;
                    case "silence":
                        return OnlineStatus.Silence;
                    default:
                        return OnlineStatus.Offline;
                }
            }
        }
    }
}
